﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RenAi.Medical.BLL;
using RenAi.Medical.Model;

namespace RenAi.Medical.Admin
{
    public partial class videoQuery : System.Web.UI.Page
    {
        //实例化对象
        HospitalBasicBLL bll = new HospitalBasicBLL();

        public void HBLoad()
        {
            this.Repeater1.DataSource = bll.GetHospitalBasicAll();
            this.Repeater1.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                HBLoad();
            }
        }

        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string eName = e.CommandName;
            string HB_Id = e.CommandArgument.ToString();
            switch (eName)
            {
                case "Delete":
                    if (bll.DeleteHospitalBasic(HB_Id) > 0)
                    {
                        Response.Write("<script>alert('删除成功！');</script>");
                        HBLoad();
                    }
                    break;
                case "Update":
                    //页面跳转
                    Response.Redirect("HB_Update.aspx?HB_Id=" + HB_Id);
                    break;
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            this.Repeater1.DataSource = bll.SearchHospitalBasic(this.txtname.Text);
            this.Repeater1.DataBind();
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            Response.Redirect("AddHospitalBasic.aspx");
        }

    }
}